package com.terrier.ui.skins.skinBaseClasses
{
    import com.terrier.ui.skins.IWxLabelButtonSkin;
    import com.terrier.ui.skins.WxTextStyle;
    import com.terrier.ui.skins.WxFlaSkinUtility;

    import flash.display.Sprite;

    public class WxLabelButtonSkinBase extends WxButtonSkinBase implements IWxLabelButtonSkin
    {
        protected var _upTxtStyle:WxTextStyle;

        protected var _overTxtStyle:WxTextStyle;

        protected var _downTxtStyle:WxTextStyle;

        protected var _disabledTxtStyle:WxTextStyle;

        protected var _leftPad:int;

        protected var _rightPad:int;

        protected var _topPad:int;

        protected var _bottomPad:int;

        public function WxLabelButtonSkinBase()
        {
            super();
        }

        public function get upTxtStyle():WxTextStyle
        {
            return _upTxtStyle;
        }

        public function get overTxtStyle():WxTextStyle
        {
            return _overTxtStyle;
        }

        public function get downTxtStyle():WxTextStyle
        {
            return _downTxtStyle;
        }

        public function get disabledTxtStyle():WxTextStyle
        {
            return _disabledTxtStyle;
        }

        public function get leftPad():int
        {
            return _leftPad;
        }

        public function get rightPad():int
        {
            return _rightPad;
        }

        public function get topPad():int
        {
            return _topPad;
        }

        public function get bottomPad():int
        {
            return _bottomPad;
        }

        override public function initByAsset(asset:Sprite):void
        {
            super.initByAsset(asset);

            if (asset == null || asset.numChildren < 2)
            {
                return;
            }
            var textAsset:Sprite = asset.getChildAt(1) as Sprite;
            _upTxtStyle = WxFlaSkinUtility.getTextStyle(textAsset, 1);
            _overTxtStyle = WxFlaSkinUtility.getTextStyle(textAsset, 2);
            _downTxtStyle = WxFlaSkinUtility.getTextStyle(textAsset, 3);
            _disabledTxtStyle = WxFlaSkinUtility.getTextStyle(textAsset, 4);

            if (_upTxtStyle != null)
            {
                _leftPad = _rightPad = _upTxtStyle.x;
                _topPad = _bottomPad = _upTxtStyle.y;
            }
        }
    }
}
